package icasue.tools.sqlhelper.core;

/**
 * @Author: Qiao Hang
 * @CreateDate: 2021/10/21 上午10:40
 * @UpdateDate:
 * @Description:
 */
public enum SaveMode {
    /**
     * Mode: [insert ignore ...]
     * ignore anyone error occur when execute command insert,
     * but in this case, driver program also con't clear if all records
     * has been persist, or in fact if or not occur errors when
     * execute insert, also can't clear error's kind,
     * Actually, using this mode, database will con't report anyone
     * error sign to driver program!
     */
    IGNORE_ERROR,


    /**
     * Mode: [replace into ...]
     * send command for insert or replace duplicate records, this command will auto
     * choose if record insert or replicate by [primary | unique] keys duplicate.
     * in face, replace into command will execute 3 steps:
     * one: search for check if exist duplicate keys.
     * two: when exist duplicate key, execute delete, other wise will execute insert.
     * three: insert new record.
     *
     * Notice: by this mode, Primary will change!
     */
    REPLACE_INTO,


    /**
     * Mode: [insert ... on duplicate key update]
     * send command for insert or update, when insert occur duplicate,
     * this command will update all columns which be submitted, and these
     * columns will be refreshed.
     *
     * Notice: by this mode, Primary will change!
     */
    DUPLICATE_UPDATE_ALL,

    /**
     * Mode: [insert ... on duplicate key update]
     * send command for insert or update, when insert occur duplicate,
     * this command will retain database's primary keys as before, other
     * columns will be refreshed.
     */
    DUPLICATE_UPDATE_IGNORE_PRIMARY,

    /**
     * Mode: [insert ... on duplicate key update]
     * send command for insert or update, when insert occur duplicate,
     * this command will retain database's primary and unique keys as before, other
     * columns will be refreshed.
     */
    DUPLICATE_UPDATE_IGNORE_UNIQUE;
}
